<{include file="scenter/block/header.html"}>

<div class="ucenter_c">
<form action="<{link ctl='scenter/weixin/addon/packet:edit' arg0=$detail.id}>" mini-form="ucenter" method="post" ENCTYPE="multipart/form-data">
<table width="100%" border="0" cellspacing="0" class="table-data form">

<tr><th>活动名称：</th><td><input type="text" name="data[title]" value="<{$detail.title|default:''}>" class="input w-300"/></td></tr>
<tr><th>关键字：</th><td><input type="text" name="data[keyword]" disabled="disabled" value="<{$detail.keyword|default:''}>" class="input w-300"/></td></tr>
<tr><th>封面图片：</th><td><input type="text" name="data[msg_pic]" value="<{$detail.msg_pic}>" <{if $detail.msg_pic}>photo="<{$pager.img}>/<{$detail.msg_pic}>"<{/if}> class="input w-300" />&nbsp;&nbsp;&nbsp;<input type="file" name="data[msg_pic]" class="input w-100" /></td></tr>

<tr><th>活动介绍：</th><td><input type="text" name="data[desc]" value="<{$detail.desc|default:''}>" class="input w-300"/></td></tr>
<tr><th>活动开始时间：</th><td><input type="text" name="data[start_time]" value="<{$detail.start_time|format:'Y-m-d'}>" class="input w-100" date="start_time" readonly/></td></tr>
<tr><th>活动结束时间：</th><td><input type="text" name="data[end_time]" value="<{$detail.end_time|format:'Y-m-d'}>" class="input w-100" date="end_time" readonly/></td></tr>
<tr><th>活动规则说明：</th><td><textarea name="data[info]" class="textarea"><{$detail.info}></textarea><br /></td></tr>


<tr><th>领取人数：</th><td><input type="text" name="data[people]" value="<{$detail.people|default:''}>" class="input w-300"/></td></tr>

<tr><th>领取次数：</th><td><input type="text" name="data[get_number]" value="<{$detail.get_number|default:''}>" class="input w-300"/></td></tr>
<tr><th>红包类型：</th><td> 
<input  type="radio" class="packet_type"   name="data[packet_type]" value="1" <{if $detail.packet_type == 1}>checked="checked"<{/if}> >手气红包&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input  type="radio" class="packet_type"   name="data[packet_type]" value="0" <{if !$detail.packet_type}>checked="checked"<{/if}>>普通红包</td></tr>
              
<tr><th>红包属性：</th><td>


  <span class="change1">
    <input type="text" class="input w-300" name="data[item_sum]" value="<{$detail.item_sum|default:''}>"> 活动资金 （被领取的红包总额度超过活动资金后将无法领取红包）<br/>
    <input type="text" class="input w-300" name="data[item_max]" value="<{$detail.item_max|default:''}>"> 面额上限 （单个红包可被抽取的最大值）<br/>
    <select name="deci" style="width:140px;">
        <option value="0">整数</option>
        <option value="1">一位小数</option>
        <option value="2">两位小数</option>
    </select>
    面额属性，整数格式：11，一位小数格式：11.1,，两位小数格式：11.11
  </span>
  <span class="change2" style="display:none">
    <input type="text" class="input w-300" name="data[item_num]" value="<{$detail.item_num|default:''}>"> 发放个数 （可被领取的红包个数，超过后将无法领取红包）<br/>
    <input type="text" class="input w-300" name="data[item_unit]" value="<{$detail.item_unit|default:''}>"> 红包面额（请填写整数或者不大于2位的小数）
  </span>
</td></tr>

<script>
  $(function(){
	<{if $detail.packet_type == 0}>
	
		$('.change1').css('display','none');
        $('.change2').css('display','');
	<{/if}>
    $('.packet_type').change(function(){
      if($(this).val() == 1){
        $('.change1').css('display','');
        $('.change2').css('display','none');
      }else if($(this).val() ==0){
        $('.change1').css('display','none');
        $('.change2').css('display','');
      }
    });
  });
</script>

<tr><th>线下兑换密码：</th><td><input type="text" name="data[password]" value="<{$detail.password|default:''}>" class="input w-300"/></td></tr>

<tr>
	<th>是否开启活动</th>
	<td>
	<ul class="group-list">
		<li>
        	<label><input type="radio" name="data[is_open]" <{if $detail.is_open == 1}>checked="checked"<{/if}> value="1"/>开启</label>&nbsp;&nbsp;
            <label><input type="radio" name="data[is_open]" <{if !$detail.is_open}>checked="checked"<{/if}> value="0"/>关闭</label>
        </li>
		<div class="clear-both"></div>
	</ul>
	</td>
</tr>

    <tr><th></th><td><input type="submit" value="保存" class="green_btn" /></td></tr>
</table>
</form>
</div>
<script type="text/javascript">
(function(K, $){
$("input[name='data[type]']").click(function(){
    $("tr[wxtype]").hide();
    $("tr[wxtype='"+$(this).val()+"']").show();
});
$("#weixin_reply_btn").click(function(e){
    e.stopPropagation(); e.preventDefault();
    var link = $(this).attr("action") || $(this).attr("href");
    Widget.Dialog.Select(link, 'N', function(ret){
        $("#weixin_reply_id").val(ret[0]);
        $("#weixin_reply_title").html(ret[1].title);
        $("#weixin_reply_photo").attr("src", "<{$pager.img}>/"+ret[1].photo);
        $(".weixin-preview").show();
    }, {title:"选择微信素材",width:720});
});
})(window.KT, window.jQuery);
</script>
<script type="text/javascript" src="<{$pager.res}>/script/widget.bmap.js"></script>
<script type="text/javascript" src="<{$pager.res}>/kindeditor/kindeditor.js"></script>
<script type="text/javascript">
(function(K, $){
var editor = KindEditor.create('textarea[kindeditor]',{uploadJson : '?magic/upload-editor.html', extraFileUploadParams:{OATOKEN:"<{$OATOKEN}>"}});
})(window.KT, window.jQuery);
</script>
<{include file="scenter/block/footer.html"}>